package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.domain.entity.YonghuEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;


import com.dao.YonghuDao;

import com.service.YonghuService;


@Service("yonghuService")
public class YonghuServiceImpl extends ServiceImpl<YonghuDao, YonghuEntity> implements YonghuService {

    @Autowired
    private YonghuDao yonghuDao;

    @Override
    public PageUtils queryPage(int pageNum, int pageSize, YonghuEntity yonghu) {

        EntityWrapper<YonghuEntity> wrapper = new EntityWrapper<>();

        if (StringUtils.isNotEmpty(yonghu.getUseraccount())) {
            wrapper.like("useraccount", yonghu.getUseraccount());
        }

        Page<YonghuEntity> page = new Page<>(pageNum, pageSize);
        page.setRecords(yonghuDao.selectPage(page, wrapper));
        return new PageUtils(page);
    }

}
